<?php

namespace app\exception;

class ApiException extends \RuntimeException
{
    public function __construct(string|array $message = "", int $code = 400, \Throwable $previous = null)
    {
        if (is_array($message)) {
            $errInfo = $message;

            if ($code === 0) {
                $code = $errInfo[0] ?? 400;
            }
        }

        parent::__construct($message, $code, $previous);
    }
}
